<?php
class AdminAction{
	
	function index()
	{
		global $app;
		$app->assign('name','Said');		
	}
	
	function php()
	{
		phpinfo();
	}
	
	/***
	* 采集网站管理
	*/
	
	function sitelist()
	{
		global $app;
		$dao = M("site");
		$do = $app->get['do'];
		$page = array();
		switch($do){
			case 'editsite':
				$page['info'] = $dao->getSiteById( $app->get['id'] );
				$page['goto'] = U("admin","sitelist","do=updatesite");
				break;
			case 'addsite':
				$page['goto'] = U("admin","sitelist","do=insertsite");
				break;
			case 'insertsite':
				$dao->insertsite();
				break;
			case 'updatesite':
				$dao->updatesite();
				break;
			case 'deletesite':
				$dao->deletesite();
				break;
			default:
				$page['list'] = $dao->getSiteAll();
		}	
		$app->assign('page',$page);	
	}	
	
	
	/***
	* 采集信息
	*/
	function picking()
	{
		set_time_limit(600);
		global $app;
		$app->blDisplay = false;
		$action = $app->post['do'];
		$dao = M("pick");
		if( $action == 'pickiteminfo' )		{
			for($i=0; $i<5; $i++){
				$result = $dao->$action();
			}
		}else{
			$result = $dao->$action();
		}
		echo json_encode($result);
	}
}
?>